//
//  YDVerticalStockNewDetailTitleView.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2018/1/10.
//  Copyright © 2018年 LK-IOS. All rights reserved.
//

#import "YDVerticalStockNewDetailTitleView.h"
#import "YDSingleStockNewsModel.h"


@interface YDVerticalStockNewDetailTitleView()

//标题
@property (nonatomic , weak) UILabel *titleLabel;

//时间
@property (nonatomic , weak) UILabel *timeLabel;


@end

@implementation YDVerticalStockNewDetailTitleView

-(void)setModel:(YDSingleStockNewsModel *)model
{
    _model = model;
    //左右间距
    CGFloat marginL = rate375(20);
    //上下间距
    CGFloat marginT;
    if (isPhoneX) {
        marginT = rateX812(10);
    }else{
        marginT = rate750(10);
    }
    
    
    self.titleLabel.text = model.title;
    self.titleLabel.frame = CGRectMake(marginL, marginT, model.detailTitleFrame.size.width, model.detailTitleFrame.size.height);
    
    self.timeLabel.text = model.timeString;
    self.timeLabel.frame = CGRectMake(marginL, model.detailTimeFrame.origin.y, model.detailTimeFrame.size.width, model.detailTimeFrame.size.height);

}

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self timeLabel];
        [self timeLabel];
    }
    return self;
}

-(UILabel *)titleLabel
{
    if (_titleLabel == nil) {
        UILabel *titleLabel = [[UILabel alloc] init];
        [self addSubview:titleLabel];
        titleLabel.textColor = [UIColor colorWithHexString:dark];
        titleLabel.font = [UIFont systemFontOfSize:font18ScreenWRate * LKScreenW];
        titleLabel.textAlignment = NSTextAlignmentLeft;
        titleLabel.numberOfLines = 0;
        _titleLabel = titleLabel;
    }
    return _titleLabel;
}

-(UILabel *)timeLabel
{
    if (_timeLabel == nil) {
        UILabel *timeLabel = [[UILabel alloc] init];
        [self addSubview:timeLabel];
        timeLabel.textColor = [UIColor colorWithHexString:blueyGrey];
        timeLabel.font = [UIFont systemFontOfSize:font12ScreenWRate * LKScreenW];
        timeLabel.textAlignment = NSTextAlignmentLeft;
        timeLabel.numberOfLines = 1;
        _timeLabel = timeLabel;
    }
    return _timeLabel;
}






@end
